<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // new Promise(resolve => {
    //   console.log('p1')
    //   resolve('p2')
    // }).then(v => console.log(v))

    // async function fn() {}
    // console.log(fn())

    // async function fn() {
    //   // return 'lisa'
    //   return new Promise(resolve => {
    //     setTimeout(() => {
    //       resolve('json')
    //     }, 1000)
    //   })
    // }
    // fn().then(v => console.log(v))

    async function fn() {
      // let name = await 'lisa'
      console.log('进入函数')
      let name = await new Promise(resolve => {
        setTimeout(() => {
          resolve('json')
        }, 2000)
      })
      console.log(1)
      console.log(name)
      let site = await new Promise(resolve => {
        setTimeout(() => {
          resolve('rose')
        }, 2000)
      })
      console.log(2)
      console.log(site)
    }
    fn()

  </script>
</body>
</html>